<?php
/**
 * Created by PhpStorm.
 * User: zhangligang
 * Date: 17/4/22
 * Time: 下午10:19
 */

namespace App\Http\Repository;


use App\Http\Models\Brand;

class BrandRepository implements Repository
{
    private $band;

    public function __construct(Brand $brand)
    {
        $this->band = $brand;

    }

    public function getBrandList(array $where, $offset = 0, $limit = 10, array $columns = ['*'])
    {

        $query = $this->band;

        foreach ($where as $item) {

            $query->where($item['key'], $item['operator'], $item['value']);

        }

        return $query->offset($offset)->limit($limit)->get($columns);

    }

}